package com.flyco.config;

import com.flyco.modules.util.ApiUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class ApiConfiguration {

    @Value(value = "${flyco.path.omsUrl}")
    private String omsUrl;

    @Value(value = "${flyco.path.yundaUrl}")
    private String yundaUrl;

    @Value(value = "${flyco.path.ztoUrl}")
    private String ztoUrl;

    @Value(value = "${flyco.zto.companyId}")
    private String ztoCompanyId;

    @Value(value = "${flyco.zto.key}")
    private String ztoKey;

    @Value(value = "${flyco.path.payUrl}")
    private String payUrl;

    @Value(value = "${flyco.path.syncUrl}")
    private String syncUrl;

    @Value(value = "${flyco.path.sfUrl}")
    private String sfUrl;

    @Value(value = "${flyco.sf.partnerID}")
    private String partnerID;

    @Value(value = "${flyco.sf.checkword}")
    private String checkword;

    @Value(value = "${flyco.path.wxmaUrl}")
    private String wxmaUrl;

    @Value(value = "${flyco.jddj.appKey}")
    private String jddjAppKey;

    @Value(value = "${flyco.jddj.appSecret}")
    private String jddjAppSecret;

    @Value(value = "${flyco.jddj.token}")
    private String jddjToken;

    @Bean
    public void initApi(){
        log.info("注入全局参数");
        ApiUtil.setOmsUrl(omsUrl);
        ApiUtil.setYundaUrl(yundaUrl);
        ApiUtil.setZtoUrl(ztoUrl);
        ApiUtil.setZtoCompanyId(ztoCompanyId);
        ApiUtil.setZtoKey(ztoKey);
        ApiUtil.setPayUrl(payUrl);
        ApiUtil.setSyncUrl(syncUrl);
        ApiUtil.setSfUrl(sfUrl);
        ApiUtil.setPartnerID(partnerID);
        ApiUtil.setCheckword(checkword);
        ApiUtil.setWxmaUrl(wxmaUrl);
        ApiUtil.setJddjAppKey(jddjAppKey);
        ApiUtil.setJddjAppSecret(jddjAppSecret);
        ApiUtil.setJddjToken(jddjToken);
    }

}
